package com.wutao.panzh.admin.service.Impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.panzh.entity.HotelItemImag;
import com.wutao.panzh.admin.mapper.HotelItemImagMapper;
import com.wutao.panzh.service.HotelItemImagService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class HotelItemImagServiceImpl implements HotelItemImagService {

    @Autowired
    private HotelItemImagMapper hotelItemImagMapper;

    @Override
    public List<HotelItemImag> getAllHotelImagByHotelId(Integer hotelId) {
        HotelItemImag hotelItemImag = new HotelItemImag();
        hotelItemImag.setHotelItemId(hotelId);
        List<HotelItemImag> list = hotelItemImagMapper.select(hotelItemImag);
        return list;
    }

    @Override
    public void removeHotelImagByImageSrcAndHoteId(String imagSrc, Integer hotelId) {
        HotelItemImag hotelItemImag = new HotelItemImag();
        hotelItemImag.setHotelItemId(hotelId);
        hotelItemImag.setHotelItemImagUrl(imagSrc);
        hotelItemImagMapper.delete(hotelItemImag);
    }
}
